#pragma once

#include <gl/glew.h>

#include <map>
#include <memory>
#include <string>
#include <vector>

class Shader;

class SubRenderer{
    public:
        SubRenderer(int width, int height, float frustumScale, float zNear, float zFar);

        void Resize(int w, int h);
        void SetCameraPosition(float x, float y, float z){ camx = x; camy = y; camz = z; }
        void SetCameraAngle(float a){ angle = a; }

        virtual void Draw()=0;
        virtual void Pick()=0;

    protected:
        std::shared_ptr<Shader> GetShader(std::string name);
        void InitialiseShaderProgram(std::string shaderName, std::vector<std::string> uniformList=std::vector<std::string>());

        float camx, camy, camz;
        float angle;

        float perspectiveMatrix[16];

        int width;
        int height;

        float frustumScale;
        float zNear;
        float zFar;

        GLuint sampler;

    private:

        std::map<std::string,std::shared_ptr<Shader>> shaders;
};
